package com.example.homework04;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {
    private EditText et_password;
    private Button btn_button;
    private EditText et_number;
    private EditText et_phone;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Log.i("MainActivityLife","调用onCreate()");
        et_password = (EditText) findViewById(R.id.et_password);
        et_phone = (EditText) findViewById(R.id.et_phone);
        et_number = (EditText) findViewById(R.id.et_number);
        btn_button = (Button) findViewById(R.id.btn_button);
        btn_button.setOnClickListener(new View.OnClickListener() {
            //@Override
            public void onClick(View v) {
                passDate();
            }
        });
    }

    public void passDate(){
        Intent intent = new Intent(this, ShowActivity.class);
        intent.putExtra("password",et_password.getText().toString().trim());
        intent.putExtra("phone",et_phone.getText().toString().trim());
        intent.putExtra("number",et_number.getText().toString().trim());
        startActivity(intent);
    }

    @Override
    protected void onStart(){
        super.onStart();
        Log.i("MainActivityLife","调用onStart()");
    }

    @Override
    protected void onResume(){
        super.onResume();
        Log.i("MainActivityLife","调用onResume()");
    }

    @Override
    protected void onPause(){
        super.onPause();
        Log.i("MainActivityLife","调用onPause()");
    }

    @Override
    protected void onStop(){
        super.onStop();
        Log.i("MainActivityLife","调用onStop()");
    }

    @Override
    protected void onDestroy(){
        super.onDestroy();
        Log.i("MainActivityLife","调用onDestroy()");
    }

    @Override
    protected void onRestart(){
        super.onRestart();
        Log.i("MainActivityLife","调用onRestart()");
    }
}